import { post } from "../../utils/request";
interface Response {
  // 定义接口的具体结构，根据实际情况添加字段
}

/**
 * 商品列表
 * 
 * @param feature 特征id
 * @param price 价格
 * @returns 返回 API 响应
 */
export default async function getGoodList(feature: number, price: string): Promise<Response> {
    const accessToken = localStorage.getItem('access_token');
  try {
    const headers = {
        'Content-Type': 'application/json',
        'Authorization': `${accessToken}`, // 将身份认证令牌添加到 Authorization 头部中
      };
    const response = await post<Response>('/api/goods/goodlist', { feature, price });
    return response.data;
  } catch (error:any) {
    if (error.response) {
      console.log(error.response);
    }
    throw error; // 重新抛出错误，以便在组件中处理
  }
}